home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Games / NeXTmille / Source / TrafficLightView.m < prev    next >
Text File  |  1991-01-11  |  2KB  |  60 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "TrafficLightView.h"
  5. #import    "cards.h"
  6. #import    "cheap_strings.h"
  7. #import    "draw_ball.h"
  8. #import    <appkit/graphics.h>
  9. #import    <assert.h>
  10.  
  11.                                                 // These data structures specify circle information to draw
  12.                                                 //    the read and green lights and two smaller balls that depict
  13.                                                 //    the traffic light lit.  For example, the roll card has the stop
  14.                                                 //    light drawn in black the the green light in light gray.  The balls
  15.                                                 //    are therefore drawn in light gray.  The stop light draws the
  16.                                                 //    green light in black and the red light in dark gray.  The balls
  17.                                                 //    are therefore drawn in dark gray.
  18.     float    redLight[]        = { 40 + 10.0,       90 + 10.0, ( 18 / 2 ) },
  19.             greenLight[]    = { 40 + 10.0,       40 + 10.0, ( 18 / 2 ) },
  20.             ulBall[]        = { 9  +  6.1090,   130 +  6.1090,  ( 11 / 2 ) },
  21.             lrBall[]        = { 80 +  6.1090,     9 +  6.1090,  ( 11 / 2 ) };
  22.  
  23. @implementation TrafficLightView
  24.  
  25.  
  26. - init
  27. {
  28.  
  29.  
  30.     [ super init ];
  31.     bottomFaceBitmap =     [[ CardImage allocFromZone:cardZone ] initFromFile:TRAFFIC_LIGHT_TEMPLATE_BOTTOM_FACE ];
  32.     assert( bottomFaceBitmap );
  33.     
  34.     return self;
  35. }
  36.  
  37.  
  38. - drawSelf:( const NXRect * )rects :( int )rectCount
  39. {
  40.  
  41.  
  42.     assert( label );
  43.     [ super drawSelf:rects :rectCount ];
  44.     if( !showTopFaceFlag ) {
  45.         float    nameBox[] = { 52, 129, 42, 14 };
  46.         
  47.         draw_ball( redLightColor,        redLight );
  48.         draw_ball( greenLightColor,        greenLight );
  49.         draw_ball( ballAndLabelColor,    ulBall );
  50.         draw_ball( ballAndLabelColor,    lrBall );
  51.         draw_string( nameBox, ballAndLabelColor, 14.0, label );
  52.     }
  53.     
  54.     return self;
  55. }
  56.  
  57.  
  58.  
  59. @end
  60.